package com.hhs.storage.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.hhs.storage.bean.AppUserAllInf;
import com.hhs.storage.bean.InputParam;
import com.hhs.storage.bean.Result;
import com.hhs.storage.bean.YymUserYijian;
import com.hhs.storage.service.UserService;
import com.hhs.storage.service.YymUserYijianService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuanjun
 * @since 2020-08-17
 */
@RestController
@RequestMapping("/do/yymuseryijian")
@Slf4j
public class YymUserYijianController {
    @Resource
    YymUserYijianService yymUserYijianService;
    @Resource
    UserService userService;
    @RequestMapping(value = "getAll")
    public Map<String, Object> getAll(InputParam inputParam) throws Exception {
        log.info("查询意见分页信息");
        EntityWrapper ew = new EntityWrapper<YymUserYijian>();
        ew.orderBy("create_time_");
        Page<YymUserYijian> result = yymUserYijianService.findPage(new Page<YymUserYijian>(inputParam.getPage(), inputParam.getSize()),inputParam);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("rows", result.getRecords());
        map.put("total",result.getTotal());
        return map;
    }
    @RequestMapping(value = "delete/{id}", method = RequestMethod.DELETE)
    public Map<String, Object> dele(@PathVariable("id") String id) {
        log.info("删除意见");
        yymUserYijianService.dele(id);
        return Result.sucJsonResp(null);
    }
}

